package com.hmall.order.web;

import com.hmall.order.pojo.OrderParams;
import com.hmall.order.service.IOrderService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/order")
@Slf4j
public class OrderController {
    @Autowired
    private IOrderService orderService;
    @PostMapping
    public Long order(@RequestBody OrderParams params) {
        log.info("参数：{}", params);
        Long order = orderService.order(params);
        orderService.sendMessage(order);
        return order;
    }
}
